package com.gildedrose.item;

import com.gildedrose.vo.Quality;

public class Backstage extends ItemAdapter {
    public Backstage(int sellIn, Quality quality) {
        super("Backstage passes to a TAFKAL80ETC concert", sellIn, quality);
    }

    // 品质`Quality`会随着时间推移而提高；当还剩10天或更少的时候，品质`Quality`每天提高2；当还剩5天或更少的时候，品质`Quality`每天提高3；但一旦过期，品质就会降为0
    @Override
    public void updateQuality() {
        if (quality < 50) {
            quality = quality + 1;

            if (sellIn < 11 && quality < 50) {
                quality = quality + 1;
            }

            if (sellIn < 6 && quality < 50) {
                quality = quality + 1;
            }
        }
    }

    @Override
    public void updateQualityStale() {
        if (sellIn < 0) {
            quality = 0;
        }
    }
}
